<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>显示所有学生</title>
    <a href="addStudent.jsp">添加学生</a>
    <style type="text/css">
        .active{
            background-color: #92f93f;
        }
    </style>
    <style type="text/css">
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            border: 1px solid #ccc;
            padding: 8px;
            text-align: center;
        }
        th {
            background-color: #f2f2f2;
        }
        /* 从第二行开始的隔行变色 */
        tbody tr:nth-child(odd) {
            background-color: #92f93f;
        }
    </style>
</head>
<body>

<h2>学生信息列表</h2>
<table border="1" width="100%">
    <tr>
        <th>ID</th>
        <th>姓名</th>
        <th>学号</th>
        <th>密码</th>
        <th>身份证号</th>
        <th>入学时间</th>
        <th>权限</th>
        <th>操作</th>
    </tr>
    <c:forEach var="student" items="${stuList}">
        <tr>
            <td>${student.id}</td>
            <td>${student.stuname}</td>
            <td>${student.stuno}</td>
            <td>${student.pwd}</td>
            <td>${student.idcard}</td>
            <td><fmt:formatDate value="${student.startdate}" pattern="yyyy-MM-dd"/></td>
            <td>
                <c:choose>
                    <c:when test="${student.status eq 1}">管理员</c:when>
                    <c:otherwise>普通学生</c:otherwise>
                </c:choose>
            </td>
            <td>
                <c:url var="deleteURI" value = "userservlet?method=deleteStudents">
                    <c:param name="id" value="${student.id}"></c:param>
                </c:url>

                <a href="${deleteURI}" onclick="return confirm('确定删除吗')">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
</body>
</html>



